package com.fsquare.inventory.domain;

import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.broadleafcommerce.common.admin.domain.AdminMainEntity;
import org.broadleafcommerce.common.presentation.AdminPresentation;
import org.broadleafcommerce.common.presentation.AdminPresentationClass;
import org.broadleafcommerce.common.presentation.client.SupportedFieldType;
import org.broadleafcommerce.core.catalog.domain.Sku;
import org.broadleafcommerce.core.catalog.domain.SkuImpl;
import org.broadleafcommerce.openadmin.web.form.entity.Field;
import org.broadleafcommerce.profile.core.domain.Customer;
import org.broadleafcommerce.profile.core.domain.CustomerImpl;

@Entity
@Table(name = "SKU_MOVEMENT")
@AdminPresentationClass(friendlyName = "SkuMovementImpl")
public class SkuMovementImpl extends AdminFieldsHandler implements SkuMovement, AdminMainEntity {
	
	@Id
	@GeneratedValue
	protected Long id;
	
	@Column(name = "QUANTITY", nullable=false)
    @AdminPresentation(friendlyName = "SkuMovementImpl_quantity", order = 3000, groupOrder = 1000, prominent = true, gridOrder = 3000, fieldType=SupportedFieldType.INTEGER)
    protected Integer quantity;
    
	@ManyToOne(optional = false, targetEntity = SkuImpl.class)
	@JoinColumn(name = "SKU_ID", referencedColumnName = "SKU_ID")
//    @AdminPresentation(friendlyName = "SkuMovementImpl_sku", order = 2000, groupOrder = 1000, prominent = true, gridOrder = 2000, fieldType=SupportedFieldType.STRING)
    protected Sku sku;

    @Column(name = "UPDATE_DATE")
    @AdminPresentation(friendlyName = "SkuMovementImpl_updateDate", order = 1000, groupOrder = 1000, prominent = true, gridOrder = 1000, fieldType=SupportedFieldType.DATE)
    protected Date updateDate;
    
    @Column(name = "MOVEMENT_TYPE")
    @Enumerated(EnumType.STRING)
    @AdminPresentation(friendlyName = "SkuMovementImpl_movementType", order = 2000, groupOrder = 1000, prominent = true, gridOrder = 2000, fieldType=SupportedFieldType.STRING)
    protected MovementType movementType;
    
    @Column(name = "DESCRIPTION")
    @AdminPresentation(friendlyName = "SkuMovementImpl_description", order = 4000, groupOrder = 1000, prominent = true, gridOrder = 4000, fieldType=SupportedFieldType.STRING)
    protected String description;
    
    @ManyToOne(optional = true, targetEntity = CustomerImpl.class)
	@JoinColumn(name = "customer_id", referencedColumnName = "CUSTOMER_ID", nullable=true)
    @AdminPresentation(friendlyName = "SkuMovementImpl_customer", order = 6000, groupOrder = 1000, prominent = true, gridOrder = 6000, fieldType=SupportedFieldType.STRING)
    protected Customer customer;
    
    @Column(name = "STORE_LOCATION")
    @AdminPresentation(friendlyName = "SkuMovementImpl_storeLocation", order = 1000, groupOrder = 1000, prominent = true, gridOrder = 7000)
    protected String storeLocation;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public Sku getSku() {
		return sku;
	}

	public void setSku(Sku sku) {
		this.sku = sku;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public MovementType getMovementType() {
		return movementType;
	}

	public void setMovementType(MovementType movementType) {
		this.movementType = movementType;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public String getStoreLocation() {
		return storeLocation;
	}

	public void setStoreLocation(String storeLocation) {
		this.storeLocation = storeLocation;
	}

	@Override
	public String getMainEntityName() {
		return null;
	}
    
}
